package com.xu.cloud.shorturl.factory;

import com.xu.cloud.shorturl.pojo.domain.ShortUrlInfoDO;

import java.util.List;
import java.util.stream.Collectors;

/**
 * ShortUrlInfoDO 简单工厂接口
 *
 * @author xuguan
 * @since 2024/3/10
 */
public interface ShortUrlInfoDOFactory {

    /**
     * 创建单个ShortUrlInfoDO
     */
    ShortUrlInfoDO create(String originUrl);

    /**
     * 批量创建ShortUrlInfoDO
     */
    default List<ShortUrlInfoDO> batchCreate(List<String> originUrls) {
        return originUrls.stream()
                .map(this::create)
                .collect(Collectors.toList());
    }
}
